<?php

use think\migration\Seeder;

class AddSealTypeAndCategory extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $configModel = new \app\admin\model\Config();
        if ($configModel->getSealTypes() == null) {
            $sealTypes = [
                'name'     => \app\admin\common\Constants::$SEAL_TYPE_KEY,
                'title'    => '印章类型',
                'type'     => 3,
                'group_id' => 2,
                'value'    => '1|合同专用章' . PHP_EOL . '2|公章' . PHP_EOL . '3|财务章' . PHP_EOL . '4|法人章',
                'remark'   => '印章类型配置',
                'sort'     => 1
            ];
            $this->table("config")->insert($sealTypes)->save();
        }

        if ($configModel->getSealStatus() == null) {
            $sealTypes = [
                'name'     => \app\admin\common\Constants::$SEAL_STATUS_KEY,
                'title'    => '印章类型',
                'type'     => 3,
                'group_id' => 2,
                'value'    => '1|禁用' . PHP_EOL . '2|可用' . PHP_EOL . '3|损坏' . PHP_EOL . '4|维修中',
                'remark'   => '印章类型配置',
                'sort'     => 1
            ];
            $this->table("config")->insert($sealTypes)->save();
        }
    }
}